<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
</head>

<body>
    <button></button>
    <button></button>
    <button></button>
    <script>
        let btn = document.querySelectorAll('button')
        console.log(btn);
        axios.defaults.params = {
            limit: 30
        }
        btn[0].onclick = function () {
            axios({
                //请求类型
                method: 'GET',
                url: 'https://autumnfish.cn/hot/topic?'

            }).then(response => {
                console.log(response);
            })
        }
        btn[1].onclick = function () {
            axios({
                //请求类型
                method: 'POST',
                url: 'http://localhost:3000/posts',
                data: {
                    title: '今天天气不曾',
                    author: '张三'
                }
            }).then(response => {
                console.log(response);
            })
        }
        btn[2].onclick = function () {
            axios({
                //请求类型
                method: 'PUT',
                url: 'http://localhost:3000/posts/3',
                data: {
                    yu: '今天',
                    author: 'lii'
                }
            }).then(response => {
                console.log(response);
            })
        }
    </script>
</body>

</html>